<?php

use Biz\service\brand\Brand;

class CardListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {

        $page = $this->getRequest()->getPost('page', 1);
        $brand_uid = $this->getRequest()->getPost('uid', 0);
        $sort = $this->getRequest()->getPost('sort', 0); //0默认 1最新  default 默认  addtime 发布时间
        $sort = $sort > 0 ? 'addtime' : 'default';

        $uid = $this->uid;
        $brandInfo = Brand::getBrandInfosByUid($brand_uid);
        
        $brand_id = $brandInfo[0]['id'] ?? 0;
        $response = \Biz\service\wiki\WikiContent::hhzPagedList($uid, $brand_id, $sort, $page);

        \Doraemon\tools\ActionLog::log($this->uid, ['brand_id' => $brand_id, 'page' => $page], \Doraemon\tools\ActionLog::BIZ_BRAND_DETAIL_USER_CONTENT);

        $this->setSuccess($response);
    }
}